package com.d4peng.test.jna;

import com.sun.jna.Library;
import com.sun.jna.Native;

import java.io.File;

/**
 * Jna方式二:字符串类型
 *
 * @author d4peng
 * @date 2021-11-25
 */
public class JnaDemo2 {
    interface StringOps extends Library {
        String send_and_accept_string(String str);
    }

    public static void main(String[] args) {
        String path = new File("").getAbsoluteFile().getPath() + "\\src\\main\\java\\com\\d4peng\\test\\jna\\c\\struct.dll";
        StringOps stringOps = (StringOps) Native.loadLibrary(path, StringOps.class);
        String str = stringOps.send_and_accept_string("d4peng");
        System.out.println(str);
    }
}
